package com.rs2hd.model;

/**
 * Manages equipment.
 *
 * @author Graham
 */
public class Equipment {

	public static final int SLOT_HAT = 0, SLOT_CAPE = 1, SLOT_AMULET = 2, SLOT_WEAPON = 3, SLOT_CHEST = 4, SLOT_SHIELD = 5, SLOT_LEGS = 7, SLOT_HANDS = 9, SLOT_FEET = 10, SLOT_RING = 12, SLOT_ARROWS = 13;
	public static final String[] BONUSES = {"Stab", "Slash", "Crush", "Magic", "Range", "Stab", "Slash", "Crush", "Magic", "Range", "Strength", "Prayer"};

	public Container<Item> equipment = new Container<Item>(SIZE, false);
	private transient boolean specialWeapon = false;

	public boolean isSpecialWeapon() {
		return specialWeapon;
	}

	public Equipment() {
	}
	private static final int[] CBOWS = new int[] {9244, 9245, 9237, 9242};
	private static final int[] CBOWSW = new int[] {9185, 9174, 9176, 9177, 9179, 9181, 9183, 9185, 8880 };

	public boolean isWieldingCBow() {
		int id = this.get(Equipment.SLOT_ARROWS) != null ? this.get(Equipment.SLOT_ARROWS).getId() : -1;

		int idW = this.get(Equipment.SLOT_WEAPON) != null ? this.get(Equipment.SLOT_WEAPON).getId() : -1;

		if(id == -1 || idW == -1) {
			return false;
		}
		for(int cbow : CBOWS) {
			for(int cbowW : CBOWSW) {
				if(cbow == id && cbowW == idW) {
					return true;
				}
			}
		}
		return false;
	}
	private transient int tempWalkAnim;

	public void setTempWalkAnim(int i) {
		this.tempWalkAnim = i;
	}

	public void setNoTempWalkAnim() {
		this.tempWalkAnim = -1;
	}

	public Item get(int slot) {
		return equipment.get(slot);
	}

	public void set(int slot, Item item) {
		if (slot == 3) {
			player.setAttackStyle(1);
			player.getActionSender().sendConfig1(43, 0);
		}
		equipment.set(slot, item);
		refresh();
	}

	public void clear() {
		equipment.clear();
		refresh();
	}

	public void setWeapon() {
	}

	public int getStandAnim() {
		if (get(3) == null) {
			return 0x328;
		}
		Item item = get(3);
		String weapon = item.getDefinition().getName();
		int id = item.getDefinition().getId();
		if (id == 4718) {
			return 2065;
		} else if (id == 4755) {
			return 2061;
		} else if (id == 4675) {
			return 809;
		} else if (id == 4734) {
			return 2074;
		} else if (id == 6528 || id == 1319) {
			return 0x811;
		} else if (weapon.equals("Saradomin staff") || weapon.equals("Guthix staff") || weapon.equals("Zamorak staff")) {
			return 0x328;
		} else if (weapon.endsWith("2h sword") || weapon.endsWith("godsword") || weapon.equals("Saradomin sword")) {
			return 7047;
		} else if (weapon.equals("Abyssal whip")) {
			return 1832;
		} else if (id == 4153) {
			return 1662;
		}
		return 0x328;
	}

	public int getWalkAnim() {
		if (this.tempWalkAnim != -1) {
			return this.tempWalkAnim;
		}
		if (get(3) == null) {
			return 0x333;
		}
		Item item = get(3);
		String weapon = item.getDefinition().getName();
		int id = item.getDefinition().getId();
		if (weapon.equals("Saradomin staff") || weapon.equals("Guthix staff") || weapon.equals("Ancient staff") ||weapon.equals("Zamorak staff")) {
			return 0x333;
		} else if (id == 4755) {
			return 2060;
		} else if (id == 4734) {
			return 2076;
		} else if (id == 4153) {
			return 1663;
		} else if (weapon.equals("Abyssal whip")) {
			return 1660;
		} else if (id == 4718 || weapon.endsWith("2h sword") || id == 6528 || weapon.endsWith("godsword") || weapon.equals("Saradomin sword")) {
			return 7046;
		} else if (id == 4726 || weapon.contains("spear") || weapon.endsWith("halberd") || weapon.contains("Staff") || weapon.contains("staff")) {
			return 1146;
		}
		return 0x333;
	}

	public int getWepEmotes() {
		if (get(3) == null) {
			return 1426;
		}
		Item item = get(3);
		int id = item.getDefinition().getId();
		switch(id) {
		case 15241: return 1603;
		case 11694: 
		case 11696: 
		case 11698: 
		case 11700: 
			return 124;
		case 4151: 
			return 620;
		case 4153: 
			return 27;
		case -1:
			return 1426;
		default:
			return 1426;
		}
	}

	public int getRunAnim() {
		if (this.tempWalkAnim != -1) {
			return this.tempWalkAnim;
		}
		if (get(3) == null) {
			return 0x338;
		}
		Item item = get(3);
		String weapon = item.getDefinition().getName();
		int id = item.getDefinition().getId();
		if (id == 4718 || weapon.endsWith("2h sword") || id == 6528 || weapon.endsWith("godsword") || weapon.equals("Saradomin sword")) {
			return 7039;
		} else if (weapon.equals("Saradomin staff") || weapon.equals("Guthix staff") || weapon.equals("Zamorak staff")) {
			return 0x338;
		} else if (id == 4755) {
			return 1831;
		} else if (id == 4734) {
			return 2077;
		} else if (id == 4675) {
			return 1210;
		} else if (id == 4726 || weapon.contains("Spear") || weapon.endsWith("halberd") || weapon.contains("Staff") || weapon.contains("staff")) {
			return 1210;
		} else if (weapon.equals("Abyssal whip")) {
			return 1661;
		} else if (id == 4153) {
			return 1664;
		}
		return 0x338;
	}

	public static boolean isTwoHanded(ItemDefinition def) {
		String wepEquiped = def.getName();
		int itemId = def.getId();
		if (itemId == 4212)
			return true;
		else if (itemId == 14484) 
			return true;
		else if (itemId == 15241) 
			return true;
		else if (itemId == 4214)
			return true;
		else if (wepEquiped.endsWith("2h sword"))
			return true;
		else if (wepEquiped.endsWith("longbow"))
			return true;
		else if (wepEquiped.equals("Seercull"))
			return true;
		else if (wepEquiped.endsWith("shortbow"))
			return true;
		else if (wepEquiped.endsWith("Longbow"))
			return true;
		else if (wepEquiped.endsWith("Shortbow"))
			return true;
		else if (wepEquiped.endsWith("bow full"))
			return true;
		else if (wepEquiped.endsWith("halberd"))
			return true;
		else if (wepEquiped.equals("Granite maul"))
			return true;
		else if (wepEquiped.equals("Karils crossbow"))
			return true;
		else if (wepEquiped.equals("Torags hammers"))
			return true;
		else if (wepEquiped.equals("Veracs flail"))
			return true;
		else if (wepEquiped.equals("Dharoks greataxe"))
			return true;
		else if (wepEquiped.equals("Guthans warspear"))
			return true;
		else if (wepEquiped.equals("Tzhaar-ket-om"))
			return true;
		else if (wepEquiped.endsWith("godsword"))
			return true;
		else if (wepEquiped.endsWith("#14484"))
			return true;
		else if (wepEquiped.equals("Saradomin sword"))
			return true;
		else
			return false;
	}

	public static boolean isFullBody(ItemDefinition def) {
		String weapon = def.getName();
		int id = def.getId();
		for (int i = 0; i < fullBodies.length; i++) {
			if (id == fullBodies[i]) 
				return true;
		}
		for (int i = 0; i < FULL_BODY.length; i++) {
			if (weapon.contains(FULL_BODY[i])) {
				return true;
			}
		}
		return false;
	}


	public static boolean isFullHat(ItemDefinition def) {
		String weapon = def.getName();
		for (int i = 0; i < FULL_HAT.length; i++) {
			if (weapon.endsWith(FULL_HAT[i])) {
				return true;
			}
		}
		return false;
	}

	public static boolean isFullMask(ItemDefinition def) {
		String weapon = def.getName();
		for (int i = 0; i < FULL_MASK.length; i++) {
			if (weapon.endsWith(FULL_MASK[i])) {
				return true;
			}
		}
		return false;
	}

	private static final String[] CAPES = {"cape", "Cape"};
	private static final String[] HATS = {"#13869", "beret","helm", "hood", "coif", "Coif", "hat", "partyhat", "Hat", "full helm (t)", "full helm (g)", "hat (t)", "hat (g)", "cav", "boater", "helmet", "mask", "Helm of neitiznot", "Morrigan's_coif", "14494", "14499"};
	private static final String[] BOOTS = {"boots", "Boots"};
	private static final String[] GLOVES = {"gloves", "gauntlets", "Gloves", "vambraces", "vamb", "bracers"};
	private static final String[] SHIELDS = {"kiteshield", "sq shield", "Toktz-ket", "books", "book", "kiteshield (t)", "kiteshield (g)", "kiteshield(h)", "defender", "shield"};
	private static final String[] AMULETS = {"scarf","amulet", "necklace", "Amulet of"};
	private static final String[] ARROWS = {"arrow", "arrows", "arrow(p)", "arrow(+)", "arrow(s)", "bolt", "Bolt rack", "Opal bolts", "Dragon bolts"};
	private static final String[] RINGS = {"ring"};
	private static final String[] BODY = {"gown","dragonhide","platebody", "chainbody", "robetop", "leathertop", "platemail", "top", "brassard", "Robe top", "body", "platebody (t)", "platebody (g)", "body(g)", "body_(g)", "chestplate", "torso", "shirt", "Morrigan's_leather_body", "Morrigan's leather body"};
	private static final String[] LEGS = {"Flared","platelegs", "plateskirt", "skirt", "bottoms", "chaps", "platelegs (t)", "platelegs (g)", "bottom", "skirt", "skirt (g)", "skirt (t)", "chaps (g)", "chaps (t)", "tassets", "legs", "Morrigan's_leather_chaps", "Morrigan's leather chaps"};
	private static final String[] WEAPONS = {"#14484","#15259","Pickaxe","Dragon claws","scimitar", "longsword", "sword", "longbow", "shortbow", "dagger", "mace", "halberd", "spear", "13879",
		"Abyssal whip", "axe", "flail", "crossbow", "Torags hammers", "dagger(p)", "dagger(+)", "dagger(s)", "spear(p)", "spear(+)",
		"spear(s)", "spear(kp)", "maul", "dart", "dart(p)", "javelin", "javelin(p)", "knife", "knife(p)", "Longbow", "Shortbow",
		"Crossbow", "Toktz-xil", "Toktz-mej", "Tzhaar-ket", "staff", "Staff", "godsword", "c'bow", "Crystal bow", "Dark bow", "Morrigan's javelin"};
	/* Fullbody is an item that covers your arms. */
	private static final String[] FULL_BODY = {"gown","dragonhide","top", "shirt", "platebody", "Ahrims robetop", "Karils leathertop", "brassard", "Robe top", "robetop", "platebody (t)", "platebody (g)", "chestplate", "torso", "Zuriel's robe top"};
	/* Fullhat covers your head but not your beard. */
	private static final String[] FULL_HAT = {"med helm", "coif", "Dharoks helm", "hood", "Initiate helm", "Coif", "Helm of neitiznot", "13896"};
	/* Fullmask covers your entire head. */
	private static final String[] FULL_MASK = {"#13869","full helm", "mask", "Veracs helm", "Guthans helm", "Torags helm", "Karils coif", "full helm (t)", "full helm (g)", "mask", "13896", "14494"};
	public static final int SIZE = 14;
	private static final int[] hats = {13869, 15021, 15027, 15033, 15039,13864,13896,14494,14499};
	private static final int[] bodies = {15022, 15028, 15034, 15040, 13887, 13858, 13884, 13870, 14479, 10386, 14492, 14497};
	private static final int[] fullBodies = {15022, 15028, 15034, 15040, 13884, 13887, 13870, 14479, 10386, 14492, 14497};
	private static final int[] pants = {13861, 15023, 15024, 15029, 15030, 15035, 15036, 15041, 15042, 13893, 13890, 14490, 14501};
	private static final int[] boots = {15025, 15031, 15037, 15043};
	private static final int[] gloves = {15026, 15032, 15038, 15044};
	private static final int[] swords = {13899, 13867, 13902, 15241};
	public static int getItemType(int wearId) {
		String weapon = ItemDefinition.forId(wearId).getName();
		if (wearId == 13738 || wearId == 13736 || wearId == 13740 || wearId == 13742 || wearId == 13744 ) {
			return 5;
		}
		if (wearId == 6914) {
			return 3;
		}
		for (int i = 0; i < swords.length; i++) {
			if (wearId == swords[i]) 
				return 3;
		}
		for (int i = 0; i < CAPES.length; i++) {
			if (weapon.contains(CAPES[i]))
				return 1;
		}
		for (int i = 0; i < hats.length; i++) {
			if (wearId == hats[i]) 
				return 0;
		}
		for (int i = 0; i < pants.length; i++) {
			if (wearId == pants[i]) 
				return 7;
		}
		for (int i = 0; i < boots.length; i++) {
			if (wearId == boots[i]) 
				return 10;
		}
		for (int i = 0; i < gloves.length; i++) {
			if (wearId == gloves[i]) 
				return 9;
		}
		for (int i = 0; i < bodies.length; i++) {
			if (wearId == bodies[i]) 
				return 4;
		}
		for (int i = 0; i < HATS.length; i++) {
			if (weapon.contains(HATS[i]))
				return 0;
		}
		for (int i = 0; i < BOOTS.length; i++) {
			if (weapon.endsWith(BOOTS[i]) || weapon.startsWith(BOOTS[i]))
				return 10;
		}
		for (int i = 0; i < GLOVES.length; i++) {
			if (weapon.endsWith(GLOVES[i]) || weapon.startsWith(GLOVES[i]))
				return 9;
		}
		for (int i = 0; i < SHIELDS.length; i++) {
			if (weapon.contains(SHIELDS[i]))
				return 5;
		}
		for (int i = 0; i < AMULETS.length; i++) {
			if (weapon.endsWith(AMULETS[i]) || weapon.startsWith(AMULETS[i]))
				return 2;
		}
		for (int i = 0; i < ARROWS.length; i++) {
			if (weapon.endsWith(ARROWS[i]) || weapon.startsWith(ARROWS[i]))
				return 13;
		}
		for (int i = 0; i < RINGS.length; i++) {
			if (weapon.endsWith(RINGS[i]) || weapon.startsWith(RINGS[i]))
				return 12;
		}
		for (int i = 0; i < BODY.length; i++) {
			if (weapon.contains(BODY[i]))
				return 4;
		}
		for (int i = 0; i < LEGS.length; i++) {
			if (weapon.contains(LEGS[i]))
				return 7;
		}
		for (int i = 0; i < WEAPONS.length; i++) {
			if (weapon.endsWith(WEAPONS[i]) || weapon.startsWith(WEAPONS[i]))
				return 3;
		}
		return -1;
	}

	private transient Player player;

	public void setPlayer(Player player) {
		this.player = player;
		this.tempWalkAnim = -1;
		this.specialWeapon = false;
	}

	public void refresh() {
		//setWeapon();
		player.getUpdateFlags().setAppearanceUpdateRequired(true);
		player.getActionSender().sendItems(387, 29, 94, equipment);
		player.getBonuses().refresh();
	}

	public Container<Item> getContainer() {
		return equipment;
	}

	public int getAttackAnimation() {
		int weapon = this.get(Equipment.SLOT_WEAPON) != null ? this.get(Equipment.SLOT_WEAPON).getId() : -1;
		int fightStyle = this.player.getAttackStyle();
		switch (weapon) {
		case 4718:
			if (fightStyle != 2) {
				return 2067;
			} else {
				return 2066;
			}
		case 11696:
		case 11694:
		case 11698:
		case 11700:
		case 1307:
		case 1309:
		case 1311:
		case 1313:
		case 1315:
		case 1317:
		case 1319:
			return 7041;
		case 9174:
		case 9175:
		case 9176:
		case 9177:
		case 9178:
		case 9179:
		case 9180:
		case 9181:
		case 9182:
		case 9183:
		case 9184:
		case 9185:
		case 9186:
			return 4230;
		case 1265:
		case 1266:
		case 1267:
		case 1268:
		case 15241:
		case 1269:
		case 1270:
		case 1271:
		case 1272:
		case 1273:
		case 1274:
		case 1275:
		case 1276:
			return 401;
		case 4755:
			return 2062;
		case 10887:
			return 5865;
		case 4151:
			return 1658;
		case 5698:
			return 402;
		case 4214:
		case 6724:
		case 861:
		case 4212:
		case 839:
		case 841:
		case 843:
		case 845:
		case 847:
		case 849:
		case 851:
		case 853:
		case 855:
		case 857:
		case 4827:
			return 426; // bows
		default:
			if (fightStyle != 2) {
				return 422;
			} else {
				return 423;
			}
		}
	}

	public int getAttackSpeed() {
		int weapon = this.get(Equipment.SLOT_WEAPON) != null ? this.get(Equipment.SLOT_WEAPON).getId() : -1;
		switch (weapon) {
		case 5698:
			return 6;
		case 15241:
			return 6;
		case 4151:
			return 5;
		case 4718:
		case 4755:
			return 9;
		case 1321:
		case 1322:
		case 1323:
		case 1324:
		case 1325:
		case 1326:
		case 1327:
		case 1328:
		case 1329:
		case 1330:
		case 1331:
		case 1332:
		case 1333:
		case 1334:
		case 4587:
			return 4;
		case 11696:
		case 11694:
		case 11698:
		case 11700:
		case 1307:
		case 1309:
		case 1311:
		case 1313:
		case 1315:
		case 1317:
		case 1319:
			return 8;
		default:
			return 7;
		}
	}

	public int getDefenceAnimation() {
		int id = this.get(Equipment.SLOT_WEAPON) != null ? this.get(Equipment.SLOT_WEAPON).getId() : -1;
		//int shield = this.get(Equipment.SLOT_SHIELD) != null ? this.get(Equipment.SLOT_SHIELD).getId() : -1;
		if (id == 10887) {
			return 5866;
		}
		if(id == 15241) {
			return 1666;
		}
		if (id == 4031) {
			return 221;
		}
		if (id == 4151) {
			return 1659;
		}
		if (id == 4718 ||
				id == -1) {
			return 424;
		}
		if (id == 4755) {
			return 2063;
		}
		if (id == 10887) {
			return 5866;
		}
		if (id == 4153) {
			return 1666;
		}
		if (id == 11694 ||
				id == 11696 ||
				id == 11698 ||
				id == 11700 ||
				id == 1307 ||
				id == 1309 || 
				id == 1311 || 
				id == 1313 || 
				id == 1315 ||
				id == 1317 ||
				id == 1319 ||
				id == 7158) {
			return 7050;
		}
		if (id == 3204) {
			return 420;
		}
		return 404;
	}

	public boolean isWieldindBow() {
		int weapon = this.get(Equipment.SLOT_WEAPON) != null ? this.get(Equipment.SLOT_WEAPON).getId() : -1;
		if (weapon == -1) {
			return false;
		}
		for (int bow : BOWS) {
			if (weapon == bow) {
				return true;
			}
		}
		return false;
	}

	private static final int[] BOWS = new int[]{4212, 4214, 4215, 4216, 4217, 4218, 4219, 4220, 4221, 4222, 4223, 837,
		767, 4734, 839, 841, 843, 845, 847, 849, 851, 853, 855, 857, 859, 861,
		2883, 4827, 6724, 11235, 9705, 767, 837, 4734, 10156, 11165, 13081, 9174, 9176, 9177, 9179, 9181, 9183, 9185, 8880};

	public int getDrawBackGraphics() {
		int id = this.get(Equipment.SLOT_ARROWS) != null ? this.get(Equipment.SLOT_ARROWS).getId() : -1;
		if (id == 882) {
			return 19;
		} else if (id == 877 || id == 878 || id == 879 || id == 880 || id == 881 || id == 4740 || id == 6061 || id == 6062 || id == 8882 || id == 9139 || id == 9140 || id == 9141 || id == 9142 || id == 9143 || id == 9144 || id == 9145 || id == 9236 || id == 9237 || id == 9238 || id == 9239 || id == 9240 || id == 9241 || id == 9242 || id == 9243 || id == 9244 || id == 9245 || id == 9286 || id == 9287 || id == 9288 || id == 9289 || id == 9290 || id == 9291 || id == 9292 || id == 9293 || id == 9294 || id == 9295 || id == 9296 || id == 9297 || id == 9298 || id == 9299 || id == 9300 || id == 9301 || id == 9302 || id == 9303 || id == 9304 || id == 9305 || id == 9306 || id == 9335 || id == 9335 || id == 9336 || id == 9337 || id == 9338 || id == 9339 || id == 9340 || id == 9341 || id == 9342 || id == 10158 || id == 10159 || id == 13083 || id == 13084 || id == 13085 || id == 13086 || id == 13280) {
			return 28;
		} else if (id == 884) {
			return 18;
		} else if (id == 886) {
			return 20;
		} else if (id == 9706) {
			return 25;
		} else if (id == 888) {
			return 21;
		} else if (id == 890) {
			return 22;
		} else if (id == 892) {
			return 24;
		} else if (id == 2532 || id == 2534 || id == 2536 || id == 2538 || id == 2540 || id == 598) {
			return 1120;
		} else if (id == 11212) {
			return 1116;
		} else if (id == 863) {
			return 213;
		} else if (id == 864) {
			return 212;
		} else if (id == 865) {
			return 214;
		} else if (id == 866) {
			return 216;
		} else if (id == 867) {
			return 217;
		} else if (id == 868) {
			return 218;
		} else if (id == 869) {
			return 215;
		} else if (id == 806) {
			return 226;
		} else if (id == 807) {
			return 227;
		} else if (id == 808) {
			return 228;
		} else if (id == 809) {
			return 229;
		} else if (id == 810) {
			return 230;
		} else if (id == 811) {
			return 231;
		} else if (id == 3093) {
			return 229;
		} else {
			return 19;
		}
	}

	public int getProjectileId() {
		int id = this.get(Equipment.SLOT_ARROWS) != null ? this.get(Equipment.SLOT_ARROWS).getId() : -1;
		if (id == 882) {
			return 10;
		} else if (id == 877 || id == 878 || id == 879 || id == 880 || id == 881 || id == 4740 || id == 6061 || id == 6062 || id == 8882 || id == 9139 || id == 9140 || id == 9141 || id == 9142 || id == 9143 || id == 9144 || id == 9145 || id == 9236 || id == 9237 || id == 9238 || id == 9239 || id == 9240 || id == 9241 || id == 9242 || id == 9243 || id == 9244 || id == 9245 || id == 9286 || id == 9287 || id == 9288 || id == 9289 || id == 9290 || id == 9291 || id == 9292 || id == 9293 || id == 9294 || id == 9295 || id == 9296 || id == 9297 || id == 9298 || id == 9299 || id == 9300 || id == 9301 || id == 9302 || id == 9303 || id == 9304 || id == 9305 || id == 9306 || id == 9335 || id == 9335 || id == 9336 || id == 9337 || id == 9338 || id == 9339 || id == 9340 || id == 9341 || id == 9342 || id == 10158 || id == 10159 || id == 13083 || id == 13084 || id == 13085 || id == 13086 || id == 13280) {
			return 28;
		} else if (id == 9706) {
			return 25;
		} else if (id == 884) {
			return 11;
		} else if (id == 886) {
			return 12;
		} else if (id == 888) {
			return 13;
		} else if (id == 890) {
			return 14;
		} else if (id == 892) {
			return 15;
		} else if (id == 2532 || id == 2534 || id == 2536 || id == 2538 || id == 2540 || id == 598) {
			return 1120;
		} else if (id == 11212) {
			return 1099;
		} else if (this.isWieldingKnives()) {
			return 249;
		} else {
			return 10;
		}
	}

	private static final int[] KNIVES = new int[]{863, 864, 865, 866, 867, 868, 869,
		870, 871, 872, 873, 874, 875, 876};

	public boolean isWieldingKnives() {
		int id = this.get(Equipment.SLOT_ARROWS) != null ? this.get(Equipment.SLOT_ARROWS).getId() : -1;
		if (id == -1) {
			return false;
		}
		for (int knife : KNIVES) {
			if (knife == id) {
				return true;
			}
		}
		return false;
	}

	public boolean hasAmmo() {
		int id = this.get(Equipment.SLOT_ARROWS) != null ? this.get(Equipment.SLOT_ARROWS).getId() : -1;
		if (id == -1) {
			return false;
		}
		if (this.get(Equipment.SLOT_ARROWS).getAmount() <= 0) {
			return false;
		}
		if (id == 882) {
			return true;
		} else if (id == 877 || id == 878 || id == 879 || id == 880 || id == 881 || id == 4740 || id == 6061 || id == 6062 || id == 8882 || id == 9139 || id == 9140 || id == 9141 || id == 9142 || id == 9143 || id == 9144 || id == 9145 || id == 9236 || id == 9237 || id == 9238 || id == 9239 || id == 9240 || id == 9241 || id == 9242 || id == 9243 || id == 9244 || id == 9245 || id == 9286 || id == 9287 || id == 9288 || id == 9289 || id == 9290 || id == 9291 || id == 9292 || id == 9293 || id == 9294 || id == 9295 || id == 9296 || id == 9297 || id == 9298 || id == 9299 || id == 9300 || id == 9301 || id == 9302 || id == 9303 || id == 9304 || id == 9305 || id == 9306 || id == 9335 || id == 9335 || id == 9336 || id == 9337 || id == 9338 || id == 9339 || id == 9340 || id == 9341 || id == 9342 || id == 10158 || id == 10159 || id == 13083 || id == 13084 || id == 13085 || id == 13086 || id == 13280) {
			return true;
		} else if (id == 9706) {
			return true;
		} else if (id == 884) {
			return true;
		} else if (id == 886) {
			return true;
		} else if (id == 888) {
			return true;
		} else if (id == 890) {
			return true;
		} else if (id == 892) {
			return true;
		} else if (id == 2532 || id == 2534 || id == 2536 || id == 2538 || id == 2540 || id == 598) {
			return true;
		} else if (id == 11212) {
			return true;
		} else if (this.isWieldingKnives()) {
			return true;
		} else {
			return false;
		}
	}

	public Item removeAmmo() {
		Item i = this.get(Equipment.SLOT_ARROWS);
		if (i != null) {
			int amt = i.getAmount() - 1;
			if (amt <= 0) {
				this.set(Equipment.SLOT_ARROWS, null);
			} else {
				this.set(Equipment.SLOT_ARROWS, new Item(i.getId(), amt));
			}
			refresh();
			return new Item(i.getId());
		} else {
			return null;
		}
	}

	public void reset() {
		equipment.reset();
		refresh();
	}

}
